import request from '@/utils/request'
// 查询所有的分类
export function fetchContentCategories() {
  return request({
    url: '/cms/content/category/list',
    method: 'get',
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
// 新增分类
export function addContentCategory(category) {
  return request({
    url: '/cms/content/category/add',
    method: 'get',
    params: category,
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
// 更新分类
export function updateContentCategory(category) {
  return request({
    url: '/cms/content/category/update',
    method: 'get',
    params: category,
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
// 删除分类
export function deleteContentCategory(id) {
  return request({
    url: '/cms/content/category/delete/' + id,
    method: 'get',
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}

// 查询所有的内容
export function fetchAllContent() {
  return request({
    url: '/cms/content/list',
    method: 'get',
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
// 根据categoryId查询内容
export function fetchContentByCategoryId(categoryId) {
  return request({
    url: '/cms/content/list/' + categoryId,
    method: 'get',
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
// 新增内容
export function addContent(content) {
  return request({
    url: '/cms/content/add',
    method: 'get',
    params: content,
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
// 更新分类
export function updateContent(content) {
  return request({
    url: '/cms/content/update',
    method: 'get',
    params: content,
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}

// 删除内容
export function deleteContent(id) {
  return request({
    url: '/cms/content/delete/' + id,
    method: 'get',
    baseURL: process.env.VUE_APP_SERVER_BASE_API
  })
}
